//
//  LRXRegularExpression.m
//  路人侠
//
//  Created by zhangxulong on 5/2/16.
//  Copyright © 2016 zhangxulong. All rights reserved.
//

#import "LRXRegularExpression.h"

@implementation LRXRegularExpression

+ (BOOL)regularExpression:(NSString *)str withPattern:(NSString *)patternStr
{
    
//    NSRegularExpression * regularexpression = [[NSRegularExpression alloc]
//                                              initWithPattern:patternStr
//                                              options:NSRegularExpressionDotMatchesLineSeparators
//                                              error:nil];
//    NSUInteger numberofMatch = [regularexpression numberOfMatchesInString:str
//                                                                  options:NSMatchingWithoutAnchoringBounds
//                                                                    range:NSMakeRange(0, str.length)];
    
//       if(numberofMatch > 0)
//      {
//          return YES;
//      }
//      return NO;
    
    
    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", patternStr];
    BOOL isValid = [predicate evaluateWithObject:str];
    return isValid;
    

}

@end
